/**
 * 用于msg-item父组件中，同步点赞状态
 */
export const syncDianZan = (pageInstance, event, listKey) => {
  let _eDetail = event.detail
  let _targetIndex = pageInstance.data[listKey].findIndex(item => item.id == _eDetail.id)
  let _target = pageInstance.data[listKey][_targetIndex]
  let _picks = {picks: _eDetail.is_pick > 0 ? (_target.picks - 0 + 1) : (_target.picks - 1)}
  pageInstance.setData({
    [`${listKey}[${_targetIndex}]`]: Object.assign({}, _target, _eDetail, _picks)
  })
}